
#ifndef __CEVENTSYSTEM_H
#define __CEVENTSYSTEM_H

#include "stdafx.h"

#include "CEvent.h"
#include "IListener.h"

class CEventSystem
{
private:

	//The database that conatians the events and who is listening for them
	multimap<EVENT, IListener*>		m_mmDatabase;

	//Events waiting to be processed
	vector<CEvent> m_CurrentEvents;

	void DispatchEvent(CEvent* pEvent);

	CEventSystem() {}
	CEventSystem(const CEventSystem&);
	CEventSystem& operator=(const CEventSystem&);

	~CEventSystem() {}

public:

	static CEventSystem* GetInstance();

	void RegisterClient(EVENT eventID, IListener* pClient);
	void UnregisterClient(EVENT eventID, IListener* pClient);
	void SendEvent(EVENT eventID, void* pData = NULL);
	void ProcessEvents();
	void ClearEvents();
	void ShutdownEventSystem();

};

#endif